package com.example.mapper;

import com.example.entity.Course;
import com.example.entity.CourseStudent;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CourseSelMapper {

    @Insert("INSERT into course_student (courseName,courseNum,studentName,studentId,courseId) value (#{courseName}," +
            "#{courseNum},#{studentName},#{studentId},#{courseId})")
    void add(CourseStudent courseStudent);
    @Select("select * from course_student where courseId = #{courseId} and studentId = #{studentId}")
    CourseStudent selectById(CourseStudent courseStudent); //根据学生id和课程id在表里查询
//    @Select("select * from course_student where courseName like concat('%',#{courseName},'%') order by id desc")
    List<CourseStudent> selectAll(CourseStudent courseStudent);
    @Delete("DELETE FROM course_student WHERE id = #{id}")
    void deleteByid(Integer id);
}
